/*
Audica Uploader - application for convenient uploading to various file hostings
Copyright (C) 2011-2012 Makarov Andrey (Winand)

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef ZHTTPMULTIPART_H
#define ZHTTPMULTIPART_H
#include "global.h"
#include <QHttpMultiPart>
#include "charsetter.h"

class ZHttpMultiPart : public Charsetter
{
Q_OBJECT
Q_ENUMS(ContentType)
public:
    explicit ZHttpMultiPart(QObject* parent = 0);
    enum ContentType {
        CT_Mixed = QHttpMultiPart::MixedType,
        CT_Related = QHttpMultiPart::RelatedType,
        CT_FormData = QHttpMultiPart::FormDataType,
        CT_Alternative = QHttpMultiPart::AlternativeType
    };
    QHttpMultiPart MultiPart;
private:
    QList<QString> parts; //contains /name/ attribute of each part,
                          //which user has provided, not /strConv/erted one
    QByteArray convName(QString str);
    QByteArray convValue(QString str);
public slots:
    bool appendField(const QString name, const QString value);
    bool appendFile(const QString name, const QString path, const QString contentType);
    bool hasPart(const QString name);
    void setContentType(ContentType ct);
};

#endif // ZHTTPMULTIPART_H
